package com.rabbit.eap.framework.core.xss;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.apache.commons.text.StringEscapeUtils;

import java.io.IOException;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.framework.core.xss
 * @className XssJacksonDeserializer
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/4/26 22:18
 * <p>Description: XssJacksonDeserializer </p>

 */
public class XssJacksonDeserializer extends JsonDeserializer<String> {

    @Override
    public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        return StringEscapeUtils.escapeHtml4(jsonParser.getText());
    }
}
